/**
 * 
 */
package com.aceitunaproject.server.terrain;

import com.aceitunaproject.server.equipment.Equipment;

/**
 * 
 * The combination of a TerrainType and an Equipment Type
 * 
 * @author Federico Bergstein
 * 
 */
public class TerrainEquipmentCombo {

	private TerrainType terrainType;
	private Equipment equipment;

	public TerrainEquipmentCombo(TerrainType terrainType, Equipment equipment) {
		this.terrainType = terrainType;
		this.equipment = equipment;

	}

	@Override
	public boolean equals(Object anObject) {
		if (!super.equals(anObject)) {
			if (anObject instanceof TerrainEquipmentCombo) {
				TerrainEquipmentCombo comparisonObject = (TerrainEquipmentCombo) anObject;
				return (this.equipment == comparisonObject.equipment && this.terrainType == comparisonObject.terrainType);

			} else {
				return false;
			}
		} else {
			return true;
		}
	}

	@Override
	public int hashCode() {
		//TODO: check if this is the right way of doing this
		return this.equipment.getName().hashCode() + this.terrainType.hashCode();
	}

}
